//
//  NewTongDaoTableViewCell.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/26.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewTongDaoTableViewCell.h"

#import "JTCSM.h"
#import "MyDoubleLabelView.h"

@interface NewTongDaoTableViewCell ()

@property (nonatomic,strong) MyDoubleLabelView *onedoubleview;
@property (nonatomic,strong) MyDoubleLabelView *twodoubleview;
@property (nonatomic,strong) MyDoubleLabelView *threedoubleview;
@property (nonatomic,strong) UIImageView *logoImageV;
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UIButton *selectButton;



@end

@implementation NewTongDaoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
       
        CGFloat imageheight =  24;
        CGFloat imageWidth = imageheight*1.541667;
        CGFloat backviewHeight = 120;
        CGFloat space = 10;
        
        UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KSCREENWidth, backviewHeight)];
        backview.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:backview];
        backview.userInteractionEnabled = YES;
        [df layerWithView:backview radius:4 width:space color:RGBACOLOR(241, 241, 241, 1)];
        
        CGFloat headerHeight = 48;
        CGFloat footerHeight = 52;
        
        self.logoImageV = [[UIImageView alloc]initWithFrame:CGRectMake(space*2, space+(headerHeight-imageheight)/2, imageWidth, imageheight)];
        [self.contentView addSubview:self.logoImageV];
        CGFloat selectbuttonsize = 25;
        CGFloat showWidth = KSCREENWidth -3*space-selectbuttonsize*2;
        self.titleLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.logoImageV)+space, self.logoImageV.LC_y, showWidth-(KVIEW_X(self.logoImageV)+space), headerHeight) text:@"" font:14 textAlignment:NSTextAlignmentLeft texcolor:[df colorWithHexString:@"333333" alpha:1] backgroundColor:nil];
        [self.contentView addSubview:self.titleLabel];
        
        [df newlineViewWithHeightofTop:space+headerHeight+2 superView:self.contentView spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
        
        self.onedoubleview = [[MyDoubleLabelView alloc]initWithFrame:CGRectMake(self.logoImageV.LC_x, space+headerHeight, showWidth/3, footerHeight) leftTitleFontsize:12 titlecolor:[df colorWithHexString:@"999999" alpha:1] contentFontsize:13 contentcolor:[df colorWithHexString:@"333333" alpha:1]];
        [self.contentView addSubview:self.onedoubleview];
        
        
        self.twodoubleview = [[MyDoubleLabelView alloc]initWithFrame:CGRectMake(self.logoImageV.LC_x+showWidth/3, space+headerHeight, showWidth/3, footerHeight) leftTitleFontsize:12 titlecolor:[df colorWithHexString:@"999999" alpha:1] contentFontsize:13 contentcolor:[df colorWithHexString:@"333333" alpha:1]];
        [self.contentView addSubview:self.twodoubleview];
        
        self.threedoubleview = [[MyDoubleLabelView alloc]initWithFrame:CGRectMake(self.logoImageV.LC_x+showWidth*2/3, space+headerHeight, showWidth/3, footerHeight) leftTitleFontsize:13 titlecolor:[df colorWithHexString:@"333333" alpha:1] contentFontsize:13 contentcolor:[df colorWithHexString:@"333333" alpha:1]];
        [self.contentView addSubview:self.threedoubleview];
        
        self.selectButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.selectButton.frame = CGRectMake(KSCREENWidth-20-selectbuttonsize, (backviewHeight-selectbuttonsize)/2, selectbuttonsize, selectbuttonsize);
        [self.selectButton setImage:[UIImage imageNamed:@"充值_未选中.png"] forState:UIControlStateNormal];
        [self.selectButton setImage:[UIImage imageNamed:@"充值_选中.png"] forState:UIControlStateSelected];
        [self.contentView addSubview:self.selectButton];
        
        self.contentView.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    }
    return self;
}

- (void)setValueWithModel:(id)model{
    self.titleLabel.text = @"普通快捷（及时秒到）";
    
    [self.onedoubleview InsertSpacesetvalueWithModel:@{KDoubleLabelTitle:@"费率",KDoubleLabelContent:@"0.50%"} changeLabelY:10];
    [self.twodoubleview InsertSpacesetvalueWithModel:@{KDoubleLabelTitle:@"结算",KDoubleLabelContent:@"3元/笔"} changeLabelY:10];
    [self.threedoubleview InsertSpacesetvalueWithModel:@{KDoubleLabelTitle:@"单笔：5000元",KDoubleLabelContent:@"当天：10000元"} changeLabelY:10];
    NSIndexPath *path = model;
    if (path.row == 1) {
        self.selectButton.selected = YES;
    }else{
        self.selectButton.selected = NO;
    }
    
}

@end
